//
//  Block_cell.m
//  Focus
//
//  Created by 楼主 on 14-10-28.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Block_cell.h"
#import "WebColor.h"
@implementation Block_cell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code

        UIImageView *block_imageView = [[UIImageView alloc]init];
        
        self.block_imageView = block_imageView;
        [block_imageView release];

#pragma mark 初始化 长压手势
        
//        self.block_imageView = [[UIImageView alloc]init];

        [self.contentView addSubview:self.block_imageView];
        UILabel *block_label = [[UILabel alloc]init];
        self.block_label = block_label;
        [block_label release];
        self.block_label.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.block_label];
        UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressAction:)];
        [self addGestureRecognizer:longPress];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.block_imageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height * 3 / 4);
    self.block_label.frame = CGRectMake(0, self.contentView.frame.size.height / 2, self.frame.size.width, self.frame.size.height / 2);
}

- (void)longPressAction:(UILongPressGestureRecognizer *)longPress
{
    [self.target performSelector:_action withObject:self];
}

- (void)dealloc
{
    [super dealloc];
    [_block_imageView release];
    [_block_label release];
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect
 {
 // Drawing code
 }
 */

@end
